package cn.funnyxb.powerremember.db.tables;

import android.database.Cursor;
import cn.funnyxb.powerremember.beans.StudyLog;
import cn.funnyxb.tools.appFrame.database.DBHolder;
import cn.funnyxb.tools.appFrame.database.DBService;
import cn.funnyxb.tools.appFrame.database.TableHolder;
import java.util.ArrayList;

public class Tbholder_studyLog extends TableHolder
{
  private boolean inited = false;

  public Tbholder_studyLog(DBHolder paramDBHolder)
    throws Exception
  {
    super(paramDBHolder, "studylog");
    if (this.inited)
      throw new Exception("has inited!");
    this.inited = true;
  }

  public void deleteByTaskId(int paramInt)
  {
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = Integer.valueOf(paramInt);
    localDBService.execSql("delete from studylog where taskid = ? ", arrayOfObject);
  }

  public void log(int paramInt1, int paramInt2, int paramInt3, long paramLong1, long paramLong2)
  {
    String str = "insert into " + this.tableName + " ( " + "datetime" + " , " + "taskid" + " , " + "groupid" + " , " + "studytype" + " , " + "costtime" + " ) " + " values(?,?,?,?,?) ";
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[5];
    arrayOfObject[0] = Long.valueOf(paramLong1);
    arrayOfObject[1] = Integer.valueOf(paramInt1);
    arrayOfObject[2] = Integer.valueOf(paramInt2);
    arrayOfObject[3] = Integer.valueOf(paramInt3);
    arrayOfObject[4] = Long.valueOf(paramLong2 - paramLong1);
    localDBService.execSql(str, arrayOfObject);
  }

  public Cursor queryByTaskId(int paramInt)
  {
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramInt;
    return localDBService.query("select * from studylog where taskid = ? ", arrayOfString);
  }

  public StudyLog queryLastLog(int paramInt)
  {
    String str = "select  * from " + this.tableName + " where " + "taskid" + " = ? " + " order by " + "_id" + " desc ";
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramInt;
    Cursor localCursor = localDBService.query(str, arrayOfString);
    if (localCursor == null);
    StudyLog localStudyLog;
    for (Object localObject = null; ; localObject = localStudyLog)
    {
      while (true)
      {
        return localObject;
        if (localCursor.getCount() != 0)
          break;
        localCursor.close();
        localObject = null;
      }
      localCursor.moveToFirst();
      localStudyLog = StudyLog.parseAStudyLogFromCursor(localCursor);
      localCursor.close();
    }
  }

  public ArrayList<Integer> queryLearnedGroupByTaskId(int paramInt)
  {
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramInt;
    Cursor localCursor = localDBService.query("select distinct groupid from studylog where taskid = ? ", arrayOfString);
    if (localCursor == null);
    for (Object localObject = null; ; localObject = null)
    {
      return localObject;
      if (localCursor.getCount() != 0)
        break;
      localCursor.close();
    }
    ArrayList localArrayList = new ArrayList();
    localCursor.moveToFirst();
    while (true)
    {
      if (localCursor.isAfterLast())
      {
        localCursor.close();
        localObject = localArrayList;
      }
      localArrayList.add(Integer.valueOf(localCursor.getInt(localCursor.getColumnIndex("groupid"))));
      localCursor.moveToNext();
    }
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.db.tables.Tbholder_studyLog
 * JD-Core Version:    0.5.3
 */